#include <printing.hpp>
#include <matrix.hpp>
#include <grayscale_to_binary.hpp>
#include <rgb_to_grayscale.hpp>
#include <contour_detection.hpp>
#include <points.hpp>
using namespace ohe_framework;
using namespace cv;
int main()
{
    Mat image= imread("vlcsnap-2012-02-04-13h06m53s96.jpg",1);
    
/*    Mat image3(Size(image.cols/2,image.rows/2),CV_8UC1);
    Mat image4(Size(image.cols/2,image.rows/2),CV_8UC1);
    imshow("image_color",image);
    waitKey(0);
    ImageMatrixUchar mat_color,mat_gray,mat_bin,mat_windows;
    mat_color.matToMatrix(image);
    if(convertToGrayscale(mat_color,mat_gray,HDTV))
    {
        mat_gray.matrixToMat(image2);
        imshow("image_gray",image2);
        waitKey(0);
        ohe_framework::Point start(image.cols/2-1,image.rows/2-1),range(image.cols/2,image.rows/2);
        std::cout<<"extracting window"<<std::endl;
        if(mat_gray.setROI(start,range))
        {
            mat_gray.matrixToMat(image3);
            imshow("image_croped",image3);
            waitKey(0);
            std::cout<<"binary window"<<std::endl;
            if(grayscaleToBinary(mat_gray,mat_bin,220))
            {
                mat_bin.matrixToMat(image4);
                imshow("image_binary",image4);
                waitKey(0);
            }
            else
            {
                printErrorMessage("Not able to convert binary image");
            }
        }
        else
        {
            printErrorMessage("Not able to convert window image");
        }
    }
    else
    {
        printErrorMessage("Not able to convert gray_scale image");
    }*/
    ImageMatrixUchar thres;
    imshow("image",image);
    waitKey(0); 
    thres.matToMatrix(image);
    ohe_framework::Point start,range;
    start.x=start.y = 100;
    range.x=range.y = 300;
    thres.setROI(start,range);
    Mat image2(Size(thres.getCols(),thres.getRows()),CV_8UC3);
    ohe_framework::Line line;
    line.start = ohe_framework::Point(100,50);
    line.end = ohe_framework::Point(10,100);
    line.drawLine(thres);
    thres.matrixToMat(image2);
    imshow("image",image2);
    waitKey(0); 
    return 0;
}
